package mysql

import (
	"doctor-medicine-system/doctorrpc/doctorrpc"
	"gorm.io/gorm"
)

type Static struct {
	gorm.Model
	Name    string `gorm:"type:varchar(50);not null"`
	Type    string `gorm:"type:varchar(50);not null"`
	Address string `gorm:"type:varchar(50);not null"`
	UserId  int64  `gorm:"type:int(11);not null"`
}

func (s *Static) StaticAdd(db *gorm.DB) error {
	return db.Debug().Create(s).Error
}

func (s *Static) FindByStatic(db *gorm.DB, list []*doctorrpc.StaticList, id int64) []*doctorrpc.StaticList {
	err = db.Debug().Where("user_id =?", id).Find(&list).Error
	return list
}
